package dnacos

import (
	"github.com/nacos-group/nacos-sdk-go/v2/vo"
)

// 注册服务
func (n NacosConfigClient[T]) RegisterServiceInstance(ip string, port int, serviceName string,
	weight int, clusterName string, group string) {
	_, err := n.serviceClient.RegisterInstance(vo.RegisterInstanceParam{
		Ip:          ip,
		Port:        uint64(port),
		ServiceName: serviceName,
		Weight:      float64(weight),
		Enable:      true,
		Healthy:     true,
		Ephemeral:   true,
		Metadata:    map[string]string{"idc": "migu"},
		ClusterName: clusterName, // default value is DEFAULT
		GroupName:   group,       // default value is DEFAULT_GROUP
	})
	if err != nil {
		panic(any(err))
	}
}
